<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        /* ES6中引入扩展操作符(展开语法)，可以方便传入多个参数
            扩展操作符,是可以展开数组和对象的
            扩展操作符合剩余参数拥有相似的语法
            不同：
                剩余参数是把所有的多余的参数进行收集起来转换成数组
                而扩展操作符把数组扩展成单个参数
        */
        let nums=[90,34,560,89,34];
        console.log(Math.max(nums));//不支持数组作为参数
        console.log(Math.max.apply(nums,nums));//将第二个参数进行自行的循环展开，将数组中的元素赋值给对应的形参
        console.log(Math.max(...nums));//将数组扩展成单个参数
        console.log(Math.min(...nums));//将数组扩展成单个参数

        //数组展开
        let a=["aa","bb","cc"];
        let b=["cc","dd","ee"];
        let arrs=[1000,2000,...a,...b];
        console.log(arrs);

        //对象展开
        let obj1={id:1,name:"朱一龙"};
        let obj2={name:"王一博",course:"web"};
        let obj3={sex:"男",...obj1,...obj2};
        console.log(obj3);

        let objs={name:"黄晓明",hobby:"baby",gender:"男",java:100,html:90};
        let {name,gender,...attrs}=objs;
        console.log(attrs);
    </script>
</head>
<body>
    
</body>
</html>